package com.yidianyanglao.service.impl;

import com.yidianyanglao.service.UserService;
import com.yidianyanglao.user.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by Administrator on 2016/11/9.
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    @Transactional(propagation=Propagation.REQUIRED,rollbackFor =RuntimeException.class)
    public String serviceTranscatiuon() {
        System.out.println("执行添加方法");
        userMapper.addUserTest("Htllo");
        //throw new RuntimeException("程序异常，执行回滚");
        return "";
    }
}
